package model;

public class Feu extends Thread{

	private Color color;
	private int time;
	private Vehicule car=new Vehicule();
	
	

	public Feu(Color c, int t)
	{
		this.color = c;
		this.time = t;
	}
	
	public void run()
	{
		while(true)
		{
			try {
				sleep(this.time);
				//System.out.println(this.color.toString());
				synchronized(this)
				{
					if (this.color.equals(Color.VERT))
						this.color = Color.ROUGE;
					else
						{
							this.color = Color.VERT;
							notify();
						}

				}
				
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}	
		}
	}
	
	public void setColor(Color c)
	{
		this.color = c;
	}
	
	public Color getColor()
	{
		Color c = this.color;
		return c;
	}
	public void setTime(int t)
	{
		this.time = t;
	}
	
	public int getTime()
	{
		int t = this.time;
		return t;
	}
	
	
}
